package xian.woniu.web.controller;



import org.springframework.web.bind.annotation.*;

import xian.woniu.entity.Diagnosis;
import xian.woniu.service.IDiagnosisService;
import xian.woniu.util.ResultVO;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author neide
 * @time 2022/07/01 17:24:02
 */
@RestController
public class DiagnosisController {
    @Resource
    private IDiagnosisService diagnosisService;

    @GetMapping("/findByPid/{pid}")
    public ResultVO findByPid(@PathVariable(value = "pid") String pid)  {

        List orders =  diagnosisService.findOrderBypid(pid);
        return ResultVO.success(orders);
    }
    @PostMapping("/insert/")
    public ResultVO saveDiagnosis(@RequestBody Diagnosis diagnosis){
        diagnosisService.addDiagnosis(diagnosis);
        return ResultVO.success("操作成功");
    }

    @GetMapping("/findDiagnosis/{pid}")
    public ResultVO findDiagnosisByPid(@PathVariable(value = "pid") String pid)  {
        List diagnosis = diagnosisService.findDiagnosisByPid(pid);
        return ResultVO.success(diagnosis);
    }
}
